﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ViewGroup.aspx.cs" Inherits="Account_ViewGroup" validateRequest="false"%>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<script src="../ckeditor/ckeditor.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">

    <asp:Panel ID="Panel1" runat="server" >
    <asp:GridView ID="GridViewMessage" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="Id" DataSourceID="SqlDataSource1" Width="100%" CellPadding="4" 
            ForeColor="#333333" GridLines="None">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="UserName" HeaderText="UserName" 
                ItemStyle-Width="100" SortExpression="UserName">
            <ItemStyle Width="100px" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="Message">
            <ItemTemplate><%# Eval("Message")%></ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Date" HeaderText="Date" ItemStyle-Width="100" 
                SortExpression="Date">
            <ItemStyle Width="100px" />
            </asp:BoundField>
        </Columns>
        <EmptyDataTemplate>
        no message
        </EmptyDataTemplate>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    </asp:Panel>
    
    <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="100%" 
        DataSourceID="SqlDataSource1" DefaultMode="Insert" 
        AutoGenerateRows="False" CellPadding="4" ForeColor="#333333" GridLines="None">
         <AlternatingRowStyle BackColor="White" />
         <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
         <EditRowStyle BackColor="#2461BF" />
         <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
         <Fields>
         <asp:TemplateField  HeaderText="Message" >
         <InsertItemTemplate>
         <asp:TextBox ID="tbMessage" CssClass="ckeditor" runat="server" TextMode="MultiLine" Text='<%# Bind("Message") %>'></asp:TextBox>
          
         </InsertItemTemplate>
         </asp:TemplateField>

        
             <asp:CommandField ShowInsertButton="True" />
         </Fields>
         <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
         <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
         <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
         <RowStyle BackColor="#EFF3FB" />
    </asp:DetailsView>






    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
      
        InsertCommand="INSERT INTO [GroupMessage] ([GroupId], [Message], [UserName], [Date]) VALUES (@GroupId, @Message, @UserName, @Date)" 
        SelectCommand="SELECT * FROM [GroupMessage] WHERE ([GroupId] = @GroupId) ORDER BY [Date] " 
       >
 
        <InsertParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="GroupId" QueryStringField="id" 
                Type="Int32" />
            <asp:Parameter Name="Message" Type="String" />
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="Date" Type="DateTime" />
        </InsertParameters>
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="GroupId" QueryStringField="id" 
                Type="Int32" />
        </SelectParameters>
       
    </asp:SqlDataSource>
</asp:Content>

